home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 May / PersonalComputerWorld-May2008-CoverdiscCD.iso / Software / Full / Nero 7 / Installation / Cab / A97B5616.cab / TextInputC5F204ED.js < prev   
Encoding:
JavaScript  |  2006-06-28  |  1.8 KB  |  46 lines

  1. // Script in this file is for the text input ActiveX Control
  2.  
  3.  
  4.  
  5. function txtInputMouseOver(item)
  6.  
  7. {
  8.  
  9.     // This function is called from the behavior file TextInput.htc. It places focus on the text input control
  10.  
  11.     // when it gets a mouseover event
  12.  
  13.     
  14.  
  15.     // if this is the first mouseover event that fires automatically when the page loads, return
  16.  
  17.     // see comments in Hilite.js for an explanation of this
  18.  
  19.     if (bFirstMouseover == true) return
  20.  
  21.     
  22.  
  23.     // make sure item is focusable
  24.  
  25.     if (event.srcElement.MCFocusable != "true" || event.srcElement.MCTempUnFocusable == "true") return
  26.  
  27.     // focus on item
  28.  
  29.     oCurFocus = item
  30.  
  31.     oCurFocus.focus()
  32.  
  33. }
  34.  
  35.  
  36.  
  37.  
  38.  
  39. function txtInputHilite(item)
  40.  
  41. {
  42.  
  43.     // This function highlights control to indicate it has focus; actually it is the control's
  44.  
  45.     // parent HTML element that gets the highlight
  46.  
  47.     
  48.  
  49.     // make sure item is focusable
  50.  
  51.     if (item.MCFocusable != "true") return
  52.  
  53.     
  54.  
  55.     // assign element its new class for highlighting
  56.  
  57.     item.parentElement.className = item.parentElement.className + "_hilite"
  58.  
  59.     // Call built-in function on the control to set focus
  60.  
  61.     item.SetInputFocus() 
  62.  
  63. }
  64.  
  65.  
  66.  
  67. function txtInputRestore(item)
  68.  
  69. {
  70.  
  71.     // this function restores non-highlight state to the control's parent HTML element
  72.  
  73.     
  74.  
  75.     // make sure item is focusable
  76.  
  77.     if (item.MCFocusable != "true") return    
  78.  
  79.     // identify class name of parent element
  80.  
  81.     var c = item.parentElement.className        
  82.  
  83.     // if class name does not end in "_hilite", exit function
  84.  
  85.     if (c.substring((c.length -7), c.length) != "_hilite") return
  86.  
  87.     // remove "_hilite" from class name to return to unhighlighted state
  88.  
  89.     item.parentElement.className = c.substring(0,(c.length -7))
  90.  
  91. }